home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / Programming / MPW Interfaces & Libraries 3.1 / CIncludes / Fonts.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-10-13  |  5.9 KB  |  234 lines  |  [TEXT/MPS ]

  1. /************************************************************
  2.  
  3. Created: Thursday, September 7, 1989 at 4:32 PM
  4.     Fonts.h
  5.     C Interface to the Macintosh Libraries
  6.  
  7.  
  8.     Copyright Apple Computer, Inc.    1985-1989
  9.     All rights reserved
  10.  
  11. ************************************************************/
  12.  
  13.  
  14. #ifndef __FONTS__
  15. #define __FONTS__
  16.  
  17. #ifndef __TYPES__
  18. #include <Types.h>
  19. #endif
  20.  
  21. #define systemFont 0
  22. #define applFont 1
  23. #define newYork 2
  24. #define geneva 3
  25. #define monaco 4
  26. #define venice 5
  27. #define london 6
  28. #define athens 7
  29. #define sanFran 8
  30. #define toronto 9
  31. #define cairo 11
  32. #define losAngeles 12
  33. #define times 20
  34. #define helvetica 21
  35. #define courier 22
  36. #define symbol 23
  37. #define mobile 24
  38. #define commandMark 17
  39. #define checkMark 18
  40. #define diamondMark 19
  41. #define appleMark 20
  42. #define propFont 36864
  43. #define prpFntH 36865
  44. #define prpFntW 36866
  45. #define prpFntHW 36867
  46. #define fixedFont 45056
  47. #define fxdFntH 45057
  48. #define fxdFntW 45058
  49. #define fxdFntHW 45059
  50. #define fontWid 44208
  51.  
  52. struct FMInput {
  53.     short family;
  54.     short size;
  55.     Style face;
  56.     Boolean needBits;
  57.     short device;
  58.     Point numer;
  59.     Point denom;
  60. };
  61.  
  62. typedef struct FMInput FMInput;
  63. struct FMOutput {
  64.     short errNum;
  65.     Handle fontHandle;
  66.     unsigned char boldPixels;
  67.     unsigned char italicPixels;
  68.     unsigned char ulOffset;
  69.     unsigned char ulShadow;
  70.     unsigned char ulThick;
  71.     unsigned char shadowPixels;
  72.     char extra;
  73.     unsigned char ascent;
  74.     unsigned char descent;
  75.     unsigned char widMax;
  76.     char leading;
  77.     char unused;
  78.     Point numer;
  79.     Point denom;
  80. };
  81.  
  82. typedef struct FMOutput FMOutput;
  83. typedef FMOutput *FMOutPtr;
  84.  
  85. struct FontRec {
  86.     short fontType;         /*font type*/
  87.     short firstChar;        /*ASCII code of first character*/
  88.     short lastChar;         /*ASCII code of last character*/
  89.     short widMax;            /*maximum character width*/
  90.     short kernMax;            /*negative of maximum character kern*/
  91.     short nDescent;         /*negative of descent*/
  92.     short fRectWidth;        /*width of font rectangle*/
  93.     short fRectHeight;        /*height of font rectangle*/
  94.     short owTLoc;            /*offset to offset/width table*/
  95.     short ascent;            /*ascent*/
  96.     short descent;            /*descent*/
  97.     short leading;            /*leading*/
  98.     short rowWords;         /*row width of bit image / 2 */
  99. };
  100.  
  101. typedef struct FontRec FontRec;
  102. struct FMetricRec {
  103.     Fixed ascent;            /*base line to top*/
  104.     Fixed descent;            /*base line to bottom*/
  105.     Fixed leading;            /*leading between lines*/
  106.     Fixed widMax;            /*maximum character width*/
  107.     Handle wTabHandle;        /*handle to font width table*/
  108. };
  109.  
  110. typedef struct FMetricRec FMetricRec;
  111. struct WidEntry {
  112.     short widStyle;         /*style entry applies to*/
  113. };
  114.  
  115. typedef struct WidEntry WidEntry;
  116. struct WidTable {
  117.     short numWidths;        /*number of entries - 1*/
  118. };
  119.  
  120. typedef struct WidTable WidTable;
  121. struct AsscEntry {
  122.     short fontSize;
  123.     short fontStyle;
  124.     short fontID;            /*font resource ID*/
  125. };
  126.  
  127. typedef struct AsscEntry AsscEntry;
  128. struct FontAssoc {
  129.     short numAssoc;         /*number of entries - 1*/
  130. };
  131.  
  132. typedef struct FontAssoc FontAssoc;
  133. struct StyleTable {
  134.     short fontClass;
  135.     long offset;
  136.     long reserved;
  137.     char indexes[48];
  138. };
  139.  
  140. typedef struct StyleTable StyleTable;
  141. struct NameTable {
  142.     short stringCount;
  143.     Str255 baseFontName;
  144. };
  145.  
  146. typedef struct NameTable NameTable;
  147. struct KernPair {
  148.     char kernFirst;         /*1st character of kerned pair*/
  149.     char kernSecond;        /*2nd character of kerned pair*/
  150.     short kernWidth;        /*kerning in 1pt fixed format*/
  151. };
  152.  
  153. typedef struct KernPair KernPair;
  154. struct KernEntry {
  155.     short kernLength;        /*length of this entry*/
  156.     short kernStyle;        /*style the entry applies to*/
  157. };
  158.  
  159. typedef struct KernEntry KernEntry;
  160. struct KernTable {
  161.     short numKerns;         /*number of kerning entries*/
  162. };
  163.  
  164. typedef struct KernTable KernTable;
  165. struct WidthTable {
  166.     Fixed tabData[256];     /*character widths*/
  167.     Handle tabFont;         /*font record used to build table*/
  168.     long sExtra;            /*space extra used for table*/
  169.     long style;             /*extra due to style*/
  170.     short fID;                /*font family ID*/
  171.     short fSize;            /*font size request*/
  172.     short face;             /*style (face) request*/
  173.     short device;            /*device requested*/
  174.     Point inNumer;            /*scale factors requested*/
  175.     Point inDenom;            /*scale factors requested*/
  176.     short aFID;             /*actual font family ID for table*/
  177.     Handle fHand;            /*family record used to build up table*/
  178.     Boolean usedFam;        /*used fixed point family widths*/
  179.     unsigned char aFace;    /*actual face produced*/
  180.     short vOutput;            /*vertical scale output value*/
  181.     short hOutput;            /*horizontal scale output value*/
  182.     short vFactor;            /*vertical scale output value*/
  183.     short hFactor;            /*horizontal scale output value*/
  184.     short aSize;            /*actual size of actual font used*/
  185.     short tabSize;            /*total size of table*/
  186. };
  187.  
  188. typedef struct WidthTable WidthTable;
  189. struct FamRec {
  190.     short ffFlags;            /*flags for family*/
  191.     short ffFamID;            /*family ID number*/
  192.     short ffFirstChar;        /*ASCII code of 1st character*/
  193.     short ffLastChar;        /*ASCII code of last character*/
  194.     short ffAscent;         /*maximum ascent for 1pt font*/
  195.     short ffDescent;        /*maximum descent for 1pt font*/
  196.     short ffLeading;        /*maximum leading for 1pt font*/
  197.     short ffWidMax;         /*maximum widMax for 1pt font*/
  198.     long ffWTabOff;         /*offset to width table*/
  199.     long ffKernOff;         /*offset to kerning table*/
  200.     long ffStylOff;         /*offset to style mapping table*/
  201.     short ffProperty[9];    /*style property info*/
  202.     short ffIntl[2];        /*for international use*/
  203.     short ffVersion;        /*version number*/
  204. };
  205.  
  206. typedef struct FamRec FamRec;
  207. #ifdef __cplusplus
  208. extern "C" {
  209. #endif
  210. pascal void InitFonts(void)
  211.     = 0xA8FE;
  212. pascal void GetFontName(short familyID,Str255 theName)
  213.     = 0xA8FF;
  214. pascal void GetFNum(const Str255 theName,short *familyID)
  215.     = 0xA900;
  216. pascal Boolean RealFont(short fontNum,short size)
  217.     = 0xA902;
  218. pascal void SetFontLock(Boolean lockFlag)
  219.     = 0xA903;
  220. pascal FMOutPtr FMSwapFont(const FMInput *inRec)
  221.     = 0xA901;
  222. pascal void SetFScaleDisable(Boolean fscaleDisable)
  223.     = 0xA834;
  224. pascal void FontMetrics(const FMetricRec *theMetrics)
  225.     = 0xA835;
  226. pascal void SetFractEnable(Boolean fractEnable);
  227. void getfnum(char *theName,short *familyID);
  228. void getfontname(short familyID,char *theName); 
  229. #ifdef __cplusplus
  230. }
  231. #endif
  232.  
  233. #endif
  234.